﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/ResponsiveTheme.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TaggerApp.Admin.Pages.EditLocationInfo.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style>  body {padding-top: 60px;padding-bottom: 40px;}      </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div><a href="<%=ResolveClientUrl("../Locations") %>" class="btn btn-inverse">Go Back to Locations </a> </div>
    <hr />
    
    <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="80%" AutoGenerateRows="False" DataKeyNames="locationID" DataSourceID="SqlDSLocationInfo" CssClass="table table-bordered table-hover">
        <Fields>
            <asp:BoundField DataField="locationID" HeaderText="locationID" InsertVisible="False" ReadOnly="True" SortExpression="locationID" ItemStyle-CssClass="hidecol" HeaderStyle-CssClass="hidecol">
<HeaderStyle CssClass="hidecol"></HeaderStyle>

<ItemStyle CssClass="hidecol"></ItemStyle>
            </asp:BoundField>
            <asp:TemplateField HeaderText="Location Name" SortExpression="locationName">
                <EditItemTemplate>
                    <asp:TextBox ID="txtBoxNameEdit" runat="server" Text='<%# Bind("locationName") %>' CssClass="input-medium"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblName" runat="server" Text='<%# Bind("locationName") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Location Place" SortExpression="locationPlace">
                <EditItemTemplate>
                    <asp:TextBox ID="txtBoxPlaceEdit" runat="server" Text='<%# Bind("locationPlace") %>' CssClass="input-medium"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblPlace" runat="server" Text='<%# Bind("locationPlace") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Address" SortExpression="Address">
                <EditItemTemplate>
                    <asp:TextBox ID="txtBoxAddEdit" runat="server" Text='<%# Bind("Address") %>' CssClass="input-xlarge"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblAdd" runat="server" Text='<%# Bind("Address") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Address 2" SortExpression="Address2">
                <EditItemTemplate>
                    <asp:TextBox ID="txtBoxAdd2Edit" runat="server" Text='<%# Bind("Address2") %>' CssClass="input-xlarge"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblAdd2" runat="server" Text='<%# Bind("Address2") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="City" SortExpression="City">
                <EditItemTemplate>
                    <asp:TextBox ID="txtBoxCityEdit" runat="server" Text='<%# Bind("City") %>' CssClass="input-small"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblCity" runat="server" Text='<%# Bind("City") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Zip Code" SortExpression="ZipCode">
                <EditItemTemplate>
                    <asp:TextBox ID="txtBoxZipEdit" runat="server" Text='<%# Bind("ZipCode") %>' CssClass="input-mini"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblZip" runat="server" Text='<%# Bind("ZipCode") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="State" SortExpression="State">
                <EditItemTemplate>
                    <asp:TextBox ID="txtBoxStateEdit" runat="server" Text='<%# Bind("State") %>' CssClass="input-mini"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblState" runat="server" Text='<%# Bind("State") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Country" SortExpression="Country">
                <EditItemTemplate>
                    <asp:TextBox ID="txtBoxCountryEdit" runat="server" Text='<%# Bind("Country") %>' CssClass="input-medium"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblCountry" runat="server" Text='<%# Bind("Country") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Province" SortExpression="Province">
                <EditItemTemplate>
                    <asp:TextBox ID="txtBoxProvinceEdit" runat="server" Text='<%# Bind("Province") %>' CssClass="input-medium"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblProvince" runat="server" Text='<%# Bind("Province") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowEditButton="True" ControlStyle-CssClass="btn btn-primary"   ButtonType="Button" />
        </Fields>
    </asp:DetailsView>

    <asp:SqlDataSource ID="SqlDSLocationInfo" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [tblLocation] WHERE [locationID] = @original_locationID AND [locationName] = @original_locationName AND (([locationPlace] = @original_locationPlace) OR ([locationPlace] IS NULL AND @original_locationPlace IS NULL)) AND (([Address] = @original_Address) OR ([Address] IS NULL AND @original_Address IS NULL)) AND (([Address2] = @original_Address2) OR ([Address2] IS NULL AND @original_Address2 IS NULL)) AND (([City] = @original_City) OR ([City] IS NULL AND @original_City IS NULL)) AND (([ZipCode] = @original_ZipCode) OR ([ZipCode] IS NULL AND @original_ZipCode IS NULL)) AND (([State] = @original_State) OR ([State] IS NULL AND @original_State IS NULL)) AND (([Country] = @original_Country) OR ([Country] IS NULL AND @original_Country IS NULL)) AND (([Province] = @original_Province) OR ([Province] IS NULL AND @original_Province IS NULL))" InsertCommand="INSERT INTO [tblLocation] ([locationName], [locationPlace], [Address], [Address2], [City], [ZipCode], [State], [Country], [Province]) VALUES (@locationName, @locationPlace, @Address, @Address2, @City, @ZipCode, @State, @Country, @Province)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [tblLocation] WHERE ([locationID] = @locationID)" UpdateCommand="UPDATE [tblLocation] SET [locationName] = @locationName, [locationPlace] = @locationPlace, [Address] = @Address, [Address2] = @Address2, [City] = @City, [ZipCode] = @ZipCode, [State] = @State, [Country] = @Country, [Province] = @Province WHERE [locationID] = @original_locationID AND [locationName] = @original_locationName AND (([locationPlace] = @original_locationPlace) OR ([locationPlace] IS NULL AND @original_locationPlace IS NULL)) AND (([Address] = @original_Address) OR ([Address] IS NULL AND @original_Address IS NULL)) AND (([Address2] = @original_Address2) OR ([Address2] IS NULL AND @original_Address2 IS NULL)) AND (([City] = @original_City) OR ([City] IS NULL AND @original_City IS NULL)) AND (([ZipCode] = @original_ZipCode) OR ([ZipCode] IS NULL AND @original_ZipCode IS NULL)) AND (([State] = @original_State) OR ([State] IS NULL AND @original_State IS NULL)) AND (([Country] = @original_Country) OR ([Country] IS NULL AND @original_Country IS NULL)) AND (([Province] = @original_Province) OR ([Province] IS NULL AND @original_Province IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_locationID" Type="Int32" />
            <asp:Parameter Name="original_locationName" Type="String" />
            <asp:Parameter Name="original_locationPlace" Type="String" />
            <asp:Parameter Name="original_Address" Type="String" />
            <asp:Parameter Name="original_Address2" Type="String" />
            <asp:Parameter Name="original_City" Type="String" />
            <asp:Parameter Name="original_ZipCode" Type="Int32" />
            <asp:Parameter Name="original_State" Type="String" />
            <asp:Parameter Name="original_Country" Type="String" />
            <asp:Parameter Name="original_Province" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="locationName" Type="String" />
            <asp:Parameter Name="locationPlace" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="Address2" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="ZipCode" Type="Int32" />
            <asp:Parameter Name="State" Type="String" />
            <asp:Parameter Name="Country" Type="String" />
            <asp:Parameter Name="Province" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="locationID" QueryStringField="id" Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="locationName" Type="String" />
            <asp:Parameter Name="locationPlace" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="Address2" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="ZipCode" Type="Int32" />
            <asp:Parameter Name="State" Type="String" />
            <asp:Parameter Name="Country" Type="String" />
            <asp:Parameter Name="Province" Type="String" />
            <asp:Parameter Name="original_locationID" Type="Int32" />
            <asp:Parameter Name="original_locationName" Type="String" />
            <asp:Parameter Name="original_locationPlace" Type="String" />
            <asp:Parameter Name="original_Address" Type="String" />
            <asp:Parameter Name="original_Address2" Type="String" />
            <asp:Parameter Name="original_City" Type="String" />
            <asp:Parameter Name="original_ZipCode" Type="Int32" />
            <asp:Parameter Name="original_State" Type="String" />
            <asp:Parameter Name="original_Country" Type="String" />
            <asp:Parameter Name="original_Province" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>

</asp:Content>
